AC_DEFUN([COLLAPSAR_CHECK_READLINE_DECLARES_HIST_ENTRY], [
  AC_CACHE_CHECK([HIST_ENTRY is declared in readline/readline.h],
                 sql_cv_hist_entry_declared,
    AC_TRY_COMPILE(
      [
#include <stdio.h>
#include <readline/readline.h>
      ],
      [ 
HIST_ENTRY entry;
      ],
      [
        sql_cv_hist_entry_declared=yes
        AC_DEFINE_UNQUOTED(HAVE_HIST_ENTRY, [1],
                           [HIST_ENTRY is defined in the outer libeditreadline])
      ],
      [sql_cv_libedit_interface=no]
    )
  )
])

AC_DEFUN([COLLAPSAR_CHECK_NEW_RL_INTERFACE], [
    AC_CACHE_CHECK([defined rl_compentry_func_t and rl_completion_func_t], sql_cv_new_rl_interface,
	AC_TRY_COMPILE(
	    [
		#include "stdio.h"
		#include "readline/readline.h"
	    ],
	    [ 
		rl_completion_func_t *func1= (rl_completion_func_t*)0;
		rl_compentry_func_t *func2= (rl_compentry_func_t*)0;
	    ],
	    [
		sql_cv_new_rl_interface=yes
	    ],
	    [sql_cv_new_rl_interface=no]
        )
    )
    if test "$sql_cv_new_rl_interface" = "yes"; then
		AC_DEFINE_UNQUOTED([USE_NEW_READLINE_INTERFACE], [1],
		[used new readline interface (are rl_completion_func_t and rl_compentry_func_t defined)])
    fi
])

